package eerbaar.shared.internal.tree;

import eerbaar.shared.tree.IAttribute;

public class Attribute<T> implements IAttribute<T> {

    private final String key;

    private final Class<T> type;

    private final T value;

    public Attribute(Class<T> type, T value, String key) {
        this.value = value;
        this.key = key;
        this.type = type;
    }

    public Attribute(IAttribute<T> a) {
        this.value = a.getValue();
        this.key = a.getKey();
        this.type = a.getType();
    }

    @Override
    public IAttribute<T> copy() {
        return new Attribute<T>(this);
    }

    @Override
    public String getKey() {
        return this.key;
    }

    @Override
    public T getValue() {
        return this.value;
    }

    @Override
    public Class<T> getType() {
        return this.type;
    }

    @Override
    public String toString() {
        return "" + this.value;
    }

}
